<?php
session_start();
ob_start();

if ($_SESSION['username'] == '') {
   header("Location: index.php");
}

	include('config.php');
	$query = "SELECT * FROM persons ";
	if ($_GET['id']) {
	    $id = $_GET['id'];
	    $query .= " where yahooid= '$id'";
	}

	$result = mysql_query($query);
	
?>	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ket qua tin kiem</title>
</head>

<body>
<p>
<?php echo $_SESSION['username'];?> <a href="logout.php">Logout</a>
</p>
<form name="timkiem" action="quanly.php" method="get">
STT: <input type="text" name="id"  />
<input type="submit" name="timkiem" value="Tim Kiem" />
</form>
<br/>
<table border="1">
<tr>
	<th>First Name</th>
	<th>Last Name</th>
	<th>Birthday</th>
	<th>Mobile</th>
	<th>Yahoo ID</th>
	<th>Email</th>
</tr>

<?php
	while($row = mysql_fetch_array($result)) {
?>
<tr>	
	<td><?php echo $row['FirstName']; ?></td>
	<td><?php echo $row['LastName']; ?></td>
	<td><?php echo $row['birthday']; ?></td>
	<td><?php echo $row['mobile']; ?></td>
	<td><?php echo $row['yahooid']; ?></td>
	<td><?php echo $row['email']; ?></td>
</tr>

<?php
    }
?>
</table>
</body>
</html>
